package com.cakin.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName: MyMVCConfig
 * @Description: MVC的配置类
 * @Date: 2020/6/14
 * @Author: cakin
 */
// 如果我们要扩展Springmvc，官方建议我们通过配置类去做
@Configuration
// https://www.bilibili.com/video/BV1PE411i7CV?p=19 对@EnableWebMvc进行了详情的解释，我们配置时，一定不能加这个注解
// @EnableWebMvc
public class MyMVCConfig implements WebMvcConfigurer {
    // 视图跳转
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/cakin").setViewName("test");
    }
}
